<!--#include file="Config.asp" -->
<!--#include file="HeadTop.asp"-->

<%
intID=int(Request("id")) '也是合并后新的ID
T_Father_id_Delete=int(Request("T_Father_id_Delete"))
SaveType=request("SaveType")
set rs=server.createobject("adodb.recordset")
set rson=server.createobject("adodb.recordset")


'SaveMod
if SaveType="EditOK" and intID<>"" and request("T_Title")<>"" then
sql="select * from Plan_target where userid="&session("AnyPIM_userID")&" and t_id="&IntID
rs.open sql,conn,1,3
rs("UserID")=session("AnyPIM_userID")
rs("T_Title")=Trim(Request("T_Title"))
rs("T_content")=Trim(Request("T_content"))
rs("T_begin_time")=Trim(Request("T_begin_time"))
rs("T_End_time")=Trim(Request("T_End_time"))
rs("T_Father_ID")=int(Request("T_Father_ID"))
rs.Update
rs.close
end If

'SaveCombination
if SaveType="CombinationOK" and intID<>"" and request("T_Father_id_Delete")<>"" then
conn.execute ("delete from Plan_target where t_id="&T_Father_id_Delete&" and userid="&session("AnyPIM_userID")&" ")   '删除Plan_target旧的记录ID
conn.execute ("update Plan_calendar set calendarMPlan="&IntID&" where calendarMPlan="&T_Father_id_Delete&" and userid="&session("AnyPIM_userID")&" ")   '更新Plan_calendar.calendarMPlan 记录
'UPDATE table_nameSET column_name = new_valueWHERE column_name = some_value
end If
%>


<table class="table table-condensed table-bordered">
<TR bgcolor='#ddeeff'>
	<TD>开始结束时间</TD>
	<TD>标题</TD>
	<TD>具体内容</TD>
	<TD>查看进度</TD>
</TR>
<%
sql="select * from Plan_target where t_id="&IntID&" and userid="&session("AnyPIM_userID")&" order by T_id desc"
rs.open sql,conn,1,1

%>
<tr style="cursor:hand" onmouseover="this.bgColor='#f6f6f6';" onmouseout="this.bgColor='';" >
	<TD><FONT COLOR="#FF0000">[<%=Trim(rs("T_begin_time"))%>--<%=Trim(rs("T_End_time"))%>]</FONT></TD>
	<TD><%=Trim(rs("T_Title"))%></TD>
	<TD><%=Trim(rs("T_content"))%></TD>
	<TD><A HREF="ObjectiveView.asp?ID=<%=int(rs("T_id"))%>">> 进度状况</A></TD>
</tr>

</TABLE>


<table class="table table-condensed table-bordered">
<FORM METHOD='POST' ACTION="?SaveType=EditOK&ID=<%=int(rs("T_id"))%>">
	<TR>
		<TD>
标题：<INPUT TYPE="text" NAME="T_Title" value='<%=Trim(rs("T_Title"))%>'><br />
开始：<INPUT TYPE="text" NAME="T_begin_time" value='<%=Trim(rs("T_begin_time"))%>'class="Wdate" onClick="WdatePicker()"><br />
结束：<INPUT TYPE="text" NAME="T_end_time" value='<%=Trim(rs("T_End_time"))%>'class="Wdate" onClick="WdatePicker()">
</TD>
<TD>
级别：
<SELECT NAME="T_Father_id">
<OPTION VALUE="0">作为顶级目标</option>
<%
SQL="select * from Plan_target where t_father_id=0 and userid="&session("AnyPIM_userID")&" order by T_ID"
rson.open sql,conn,1,1
For son=1 To rson.recordcount
%>
<OPTION VALUE="<%=rson("T_id")%>" <%If Int(rs("T_Father_id"))=Int(rson("T_id")) Then%>selected<%End if%>><%=trim(rson("T_Title"))%>/<%=trim(rson("T_End_time"))%></OPTION>
<%
rson.moveNext
next
rson.close
%>
</SELECT>
<br />
详细：<TEXTAREA NAME="T_Content" ROWS="4" COLS="50"><%=Trim(rs("T_content"))%></TEXTAREA></TD>
<TD>
<%
'AnyPIM_Free_Right权限检测
If session("AnyPIM_RightEdit")=1 then
%>
<INPUT TYPE="submit" value='>> 调整目标'>
<%End if%>
</TD>

</TR>
</FORM>
</TABLE>
<%
rs.close
%>


<%
'合并权限检测
If session("AnyPIM_RightIncorporate")=1 then
%>
<!-- 目标合并开始 -->

<table class="table table-condensed table-bordered">
<FORM METHOD=POST ACTION="?SaveType=CombinationOK">
<TR>
<TD class="info text-class">
将二级目标:
<SELECT NAME="T_Father_id_Delete">
<%
SQL="select * from Plan_target where T_Father_ID<>0 and userid="&session("AnyPIM_userID")&" order by T_ID"
rs.open sql,conn,1,1
For s=1 To rs.recordcount
%>
<OPTION VALUE="<%=rs("T_id")%>"><%=rs("T_id")%>.<%=trim(rs("T_Title"))%>/<%=trim(rs("T_End_time"))%></OPTION>
<%
rs.moveNext
next
rs.close
%>
</SELECT>
合并到二级目标
<SELECT NAME="ID">
<%
'SQL="select * from Plan_target where "&Date()&" between T_begin_time and T_End_time and T_Father_ID<>0 order by T_ID"
SQL="select * from Plan_target where T_Father_ID<>0 and userid="&session("AnyPIM_userID")&" order by T_ID"

rs.open sql,conn,1,1
For s=1 To rs.recordcount
%>
<OPTION VALUE="<%=rs("T_id")%>"><%=rs("T_id")%>.<%=trim(rs("T_Title"))%>/<%=trim(rs("T_End_time"))%></OPTION>
<%
rs.moveNext
next
rs.close
%>
</SELECT>
&nbsp;&nbsp;

<B><FONT COLOR="#FF0000">此过程不可逆</FONT></B>
<INPUT TYPE="submit" value=' > 开始合并'>
</TD>
</TR>
</form>
</TABLE>
<!-- 目标合并开始 -->
<%End if%>
<!-- #include file="foot.asp" -->
